Bake the workspace skeleton's bundle into the generator image - #45
Merged
Conversation
Every workspace starts as a copy of lib/preview/skeleton, lockfile and frozen .bundle/config included, and the agent sandbox is the generator image itself. The generator's own lock had moved past the skeleton's (rails 8.1.3.1 vs 8.1.3, puma 8.0.2 vs 8.0.1, sqlite3 2.9.6 vs 2.9.3), so `bundle check` inside every sandbox failed and Bundler re-downloaded all 116 gems into the throwaway container, revision after revision. On project 36 (2026-09-03) that was ~9 of 32 minutes and an extra fix-agent call per step, with verify never reaching the tests before remediation; the follow-up modification paid 97s of its 173s. The build stage now installs the skeleton's bundle next to the generator's and runs `bundle check` against it, so a future drift fails the image build instead of billing every revision. Verified locally: both bundles resolve, and the skeleton's `bundle check` passes as root and as uid 1000. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117StvHb26xv3MUepWHhcWy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Every project workspace is a copy of
lib/preview/skeleton(itsGemfile.lockand frozen.bundle/configincluded), and the agent sandbox runs the generator image. The generator's lock had moved past the skeleton's (rails 8.1.3.1vs8.1.3,puma 8.0.2vs8.0.1,sqlite3 2.9.6vs2.9.3), so inside every sandboxbundle checkfailed and Bundler re-downloaded all 116 gems into a container that is discarded a minute later.Measured on production project 36 (2026-09-03, logs in
tmp/hifumi_project_36*.loglocally):What
Dockerfilebuild stage: copy the skeleton'sGemfile+Gemfile.lock,bundle installthem into the sameBUNDLE_PATH, thenbundle checkso a future drift fails the image build instead of billing every revision. Cache cleanup moved after both installs.CHANGELOG.md1.5.1 Fixed entry; the "bundle vendoring" residual removed fromCLAUDE.mdanddocs/09-ideas/05-followups.md.Verified
docker build --target buildlocally (arm64): both bundles present,bundle checksatisfied for the generator, for the skeleton, and for the skeleton as uid 1000 (the sandbox user). Skeleton install adds ~8s to the build.After merge
kamal deployrebuilds the image. Expect a build step to drop by ~80–95s and one fix-agent call, and W2.4 verify to run the generated app's tests on the first pass again.🤖 Generated with Claude Code
https://claude.ai/code/session_0117StvHb26xv3MUepWHhcWy